package com.game.HUD;

import java.io.IOException;
import java.io.InputStream;

import javax.microedition.khronos.opengles.GL10;

import object.obj2D.graphics.Font;
import system.Device;
import system.Graphics;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;

import com.game.R;

public class ShowScore {
	static private Font s_font;
	static byte[] numberFontCharWidth = {9,7,9,9,9,9,8,9,9,9};
	static String numberFontMap = "0123456789";
	private static int m_fSrcHeight;
	private static GL10 gl;
	private static int m_fSrcWidth;
	
	public static void Init()
	{
		m_fSrcWidth = Device.GetWidth();
		m_fSrcHeight = Device.GetHeight();
		gl = Graphics.GetGraphics();
		
		
		InputStream is = Device.GetContext().getResources().openRawResource(R.drawable.font_number); 
		Bitmap bitmap = BitmapFactory.decodeStream(is);
		try {
			is.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
		
		s_font = new Font(bitmap, numberFontCharWidth, 9, 2, numberFontMap);
	}
	
	public static void Render()
	{
		gl.glMatrixMode(GL10.GL_MODELVIEW);
		gl.glPushMatrix();
		gl.glLoadIdentity();
		
		gl.glTranslatef(0, m_fSrcHeight/2 - 25, 0);
		gl.glScalef(4, 4, 4);
		s_font.drawString(gl, "250", 0, 0, Font.ALIGN_CENTER);
		
		gl.glPopMatrix();
	}
}
